Resolves #216 Inconsistent Mark as Complete, checkboxes and Percentage of Video Completed #252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#216
Hi @hkirat
My Approach to solve this issue
I have created an atom, which will be storing the completed status of all the contents present in the course. It will be in this form
[
{id : 2 ,
parentId : 1,
isCompleted : false},
{
id : 3,
parentId : 1,
isCompleted : true
}]
I can't use server function in client side so I can't use selectors here to fetch the data. So, I am initialising this atoms value using SideBar Component, whenever Sidebar is mounted, it will initialise the atom's value.
The Percentage completed shown on the folders is also handled, specifically parentId is used to calculate all children and the children which have completed the video. In this way I have tacked the percentage state also
In the ContentRendererClient where markAsComplete was written, I have shifted it to a new component just to avoid Re-renders of the video player otherwise, video was flickering was state was changing.
Untitled.video.-.Made.with.Clipchamp.2.mp4
This is a collaborative effort of me and @devsargam